﻿using System;
using System.Collections.Generic;
using System.Linq;
using PhysicsProject.Enum;

namespace PhysicsProject.Models
{
    public class Material
    {
        public static Material Aluminum = new Material("Aluminum", 237, MaterialType.Metal);
        public static Material Antimony = new Material("Antimony", 18.5f, MaterialType.Metal);
        public static Material Beryllium = new Material("Beryllium", 218, MaterialType.Metal);
        public static Material Brass = new Material("Brass", 110, MaterialType.Metal);
        public static Material Cadmium = new Material("Cadmium", 92, MaterialType.Metal);
        public static Material Cobalt = new Material("Cobalt", 69, MaterialType.Metal);
        public static Material Constantan = new Material("Constantan", 22, MaterialType.Metal);
        public static Material Copper = new Material("Copper", 398, MaterialType.Metal);
        public static Material Gold = new Material("Gold", 315, MaterialType.Metal);
        public static Material Iridium = new Material("Iridium", 147, MaterialType.Metal);
        public static Material CastIron = new Material("Cast Iron", 55, MaterialType.Metal);
        public static Material PureIron = new Material("Pure Iron", 80.3f, MaterialType.Metal);
        public static Material WroughtIron = new Material("Wrought Iron", 59, MaterialType.Metal);
        public static Material Lead = new Material("Lead", 35.2f, MaterialType.Metal);
        public static Material Magnesium = new Material("Magnesium", 156, MaterialType.Metal);
        public static Material Molybdenum = new Material("Molybdenum", 138, MaterialType.Metal);
        public static Material Monel = new Material("Monel", 26, MaterialType.Metal);
        public static Material Nickel = new Material("Nickel", 90.5f, MaterialType.Metal);
        public static Material Platinum = new Material("Platinum", 73, MaterialType.Metal);
        public static Material Silver = new Material("Silver", 427, MaterialType.Metal);
        public static Material CarbonSteel = new Material("Carbon Steel ", 50, MaterialType.Metal);
        public static Material StainlessSteel = new Material("Stainless Steel", 25, MaterialType.Metal);
        public static Material Tin = new Material("Tin", 67, MaterialType.Metal);
        public static Material Zinc = new Material("Zinc", 113, MaterialType.Metal);
        public static Material Acrylic = new Material("Acrylic", 0.2f, MaterialType.Plastic);
        public static Material NylonSix = new Material("Nylon 6", 0.25f, MaterialType.Plastic);
        public static Material Polythene = new Material("Polythene (HDPE)", 0.5f, MaterialType.Plastic);
        public static Material Polytetrafluoroethylene = new Material("Polytetrafluoroethylene (PTFE)", 0.25f, MaterialType.Plastic);
        public static Material PolyvinylChloride = new Material("Polyvinyl Chloride (PVC)", 0.19f, MaterialType.Plastic);
        public static Material Asphalt = new Material("Asphalt", 1.26f, MaterialType.OtherSolid);
        public static Material Bitumen = new Material("Bitumen", 0.17f, MaterialType.OtherSolid);
        public static Material BreezeBlock = new Material("Breeze Block", 0.15f, MaterialType.OtherSolid);
        public static Material Brickwork = new Material("Brickwork", 0.6f, MaterialType.OtherSolid);
        public static Material DenseBrick = new Material("Brick - Dense", 1.6f, MaterialType.OtherSolid);
        public static Material Carbon = new Material("Carbon", 0.17f, MaterialType.OtherSolid);
        public static Material LowDensityConcrete = new Material("Concrete (Low Density)", 0.2f, MaterialType.OtherSolid);
        public static Material MediumDensityConcrete = new Material("Concrete (Medium Density)", 0.5f, MaterialType.OtherSolid);
        public static Material HighDensityConcrete = new Material("Concrete (High Density)", 1.5f, MaterialType.OtherSolid);
        public static Material Firebrick = new Material("Firebrick", 1.09f, MaterialType.OtherSolid);
        public static Material Glass = new Material("Glass", 1.05f, MaterialType.OtherSolid);
        public static Material BorosilicateGlass = new Material("Glass - Borosilicate", 1.3f, MaterialType.OtherSolid);
        public static Material Ice = new Material("Ice", 2.18f, MaterialType.OtherSolid);
        public static Material Limestone = new Material("Limestone", 1.1f, MaterialType.OtherSolid);
        public static Material Mica = new Material("Mica", 0.75f, MaterialType.OtherSolid);
        public static Material Cement = new Material("Cement", 1.01f, MaterialType.OtherSolid);
        public static Material ParafinWax = new Material("Parafin Wax", 0.25f, MaterialType.OtherSolid);
        public static Material Porcelain = new Material("Porcelain", 1.05f, MaterialType.OtherSolid);
        public static Material Sand = new Material("Sand", 0.06f, MaterialType.OtherSolid);
        public static Material Balsa = new Material("Balsa", 0.048f, MaterialType.Insulation);
        public static Material ComposedStraw = new Material("Straw - Composed", 0.09f, MaterialType.Insulation);
        public static Material CottonWool = new Material("Cotton Wool", 0.029f, MaterialType.Insulation);
        public static Material ExpandedPolystyrene = new Material("Polystyrene - Expanded ", 0.03f, MaterialType.Insulation);
        public static Material Felt = new Material("Felt", 0.04f, MaterialType.Insulation);
        public static Material GlassWool = new Material("Glass Wool", 0.040f, MaterialType.Insulation);
        public static Material Kapok = new Material("Kapok", 0.034f, MaterialType.Insulation);
        public static Material Magnesia = new Material("Magnesia", 0.07f, MaterialType.Insulation);
        public static Material Plywood = new Material("Plywood", 0.13f, MaterialType.Insulation);
        public static Material RockWool = new Material("Rock Wool", 0.045f, MaterialType.Insulation);
        public static Material Sawdust = new Material("Sawdust", 0.06f, MaterialType.Insulation);
        public static Material SlagWool = new Material("Slag Wool", 0.042f, MaterialType.Insulation);
        public static Material Wood = new Material("Wood", 0.13f, MaterialType.Insulation);
        public static Material SheepWool = new Material("Sheep's Wool", 0.038f, MaterialType.Insulation);
        public static Material Cellulose = new Material("Cellulose", 0.039f, MaterialType.Insulation);
        public static Material Benzene = new Material("Benzene", 0.16f, MaterialType.Liquid);
        public static Material CarbTetIde = new Material("Carb Tet'ide", 0.11f, MaterialType.Liquid);
        public static Material Acetone = new Material("Acetone", 0.16f, MaterialType.Liquid);
        public static Material Ether = new Material("Ether", 0.14f, MaterialType.Liquid);
        public static Material Glycerol = new Material("Glycerol", 0.28f, MaterialType.Liquid);
        public static Material Kerosene = new Material("Kerosene", 0.15f, MaterialType.Liquid);
        public static Material Mercury = new Material("Mercury", 8f, MaterialType.Liquid);
        public static Material Methanol = new Material("Methanol", 0.21f, MaterialType.Liquid);
        public static Material MachineOil = new Material("Machine Oil", 0.15f, MaterialType.Liquid);
        public static Material Water = new Material("Water", 0.58f, MaterialType.Liquid);
        public static Material Sodium = new Material("Sodium", 84, MaterialType.Liquid);
        public static Material Air = new Material("Air", 0.024f, MaterialType.Gas);
        public static Material Ammonia = new Material("Ammonia", 0.022f, MaterialType.Gas);
        public static Material Argon = new Material("Argon", 0.016f, MaterialType.Gas);
        public static Material CarbonDioxide = new Material("Carbon Dioxide", 0.015f, MaterialType.Gas);
        public static Material CarbonMonoxide = new Material("Carbon Monoixide", 0.023f, MaterialType.Gas);
        public static Material Helium = new Material("Helium", 0.142f, MaterialType.Gas);
        public static Material Hydrogen = new Material("Hydrogen", 0.168f, MaterialType.Gas);
        public static Material Methane = new Material("Methane", 0.030f, MaterialType.Gas);
        public static Material Nitrogen = new Material("Nitrogen", 0.024f, MaterialType.Gas);
        public static Material Oxygen = new Material("Oxygen", 0.024f, MaterialType.Gas);
        public static Material WaterVapor = new Material("Water Vapor", 0.016f, MaterialType.Gas);

        private static List<Material> MaterialsList;

        public string Name { get; private set; }

        public float Coefficient { get; private set; }

        public MaterialType MaterialType { get; private set; }


        public Material(string name, float coefficient, MaterialType type)
        {
            Name = name;
            Coefficient = coefficient;
            MaterialType = type;

            if(MaterialsList == null)
                MaterialsList = new List<Material>();
            MaterialsList.Add(this);
        }

        public override string ToString()
        {
            return Name;
        }

        public static IEnumerable<Material> Materials
        {
            get { return MaterialsList.AsEnumerable(); }
        }

        public static IEnumerable<Material> GetMeterialsByType(MaterialType type)
        {
            return MaterialsList.Where(m => (m.MaterialType & type) > 0x0).AsEnumerable();
        }
    }
}
